<%@page import="RssEasy.Core.CookieHelper"%>
<%@page import="RssEasy.Core.DateTimeExtend"%>
<%@page import="RssEasy.Core.HttpRequestHelper"%>
<%@page import="Model.Purchase.PurchaseOfferList"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%
    PurchaseOfferList pol = new PurchaseOfferList(pageContext);
    HttpRequestHelper hrh = new HttpRequestHelper(pageContext).request();
    CookieHelper cookie = new CookieHelper(request, response);
    String level = cookie.Get("level");
    String myid;
    if (level.equals("0")) {
        myid = cookie.Get("myid");
    } else {
        myid = cookie.Get("level");
    }
    pol.keyvalue("myid",myid).keyvalue("typid", "2").keyvalue("purchaseid",hrh.get("purchaseid")).timestamp()
            .keyvalue("corpname",hrh.get("corpname")).keyvalue("linkname",hrh.get("linkname")).keyvalue("phone",hrh.get("phone"));
    if (pol.select().where("myid=? and purchaseid=?", myid, hrh.get("purchaseid")).get_first_rows()) {
        out.print("2");
    } else {
        pol.append().submit();
        out.print("1");
    }
%>
